n, m = map(int, input().split())
vm = [[0 for _ in range(n)] for _ in range(n)]
dp = [-1]*n
for _ in range(m):
    a, b = map(int, input().split())
    vm[a-1][b-1] = 1
    vm[b-1][a-1] = 1

def bfs(s,n):
    stack = []
    stack.append(s)
    dp[s] = 1
    while stack:
        f = stack[0]
        stack.pop()
        for i in range(n):
            if vm[f][i] and dp[f] == -1:
                stack.append(i)
                dp[i] = dp[f]+1
            if vm[f][i] and dp[f] == dp[i]:
                return False

flag = False
for i in range(n):
    if dp[i] == -1 and not bfs(i, n):
        flag = True
        break
res = "No"
if flag: res = "Yes"
print(res)
